﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Yatagan.Library
{
    public class ObjectCreator
    {
        public static Type GetObjectType(string objectAndAssembly)
        {
            string[] objectAndAssemblyArray = objectAndAssembly.Split(',');
            return Assembly.Load(objectAndAssemblyArray[1].Trim()).GetType(objectAndAssemblyArray[0].Trim());
        }

        public static T CreateObjectInstance<T>(Type type)
        {
            return (T)CreateObjectInstance(type);
        }

        public static object CreateObjectInstance(Type type)
        {
            return Activator.CreateInstance(type);
        }
    }
}
